﻿@model Khachhang

<h2>Quản lý Khách Hàng</h2>

<div class="row">
    <div class="col-md-8">

        @using (Html.BeginForm("Index", "Khachhang", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
        {
            <hr />
            @Html.ValidationSummary(true)
            
            <div class="form-group">
                @Html.Label("Id", new { @class = "col-md-5 control-label" })
                <div class="col-md-7">
                    @Html.TextBoxFor(m => m.Id, new { @class = "form-control" })
                    @Html.ValidationMessageFor(m => m.Id)
                </div>
            </div>
           
            <div class="form-group">
                @Html.Label("Tên khách hàng", new { @class = "col-md-5 control-label" })
                <div class="col-md-7">
                    @Html.TextBoxFor(m => m.Tenkhachhang, new { @class = "form-control" })
                    @Html.ValidationMessageFor(m => m.Tenkhachhang)
                </div>
            </div>
            <div class="form-group">
                @Html.Label("Tên đăng nhập", new { @class = "col-md-5 control-label" })
                <div class="col-md-7">
                    @Html.TextBoxFor(m => m.Tendangnhap, new { @class = "form-control" })
                    @Html.ValidationMessageFor(m => m.Tendangnhap)
                </div>
            </div>
            <div class="form-group">
                @Html.Label("Mật khẩu", new { @class = "col-md-5 control-label" })
                <div class="col-md-7">
                    @Html.TextBoxFor(m => m.Matkhau, new { @class = "form-control" })
                    @Html.ValidationMessageFor(m => m.Matkhau)
                </div>
            </div>
            <div class="form-group">
                @Html.Label("Email", new { @class = "col-md-5 control-label" })
                <div class="col-md-7">
                    @Html.TextBoxFor(m => m.Email, new { @class = "form-control" })
                    @Html.ValidationMessageFor(m => m.Email)
                </div>
            </div>
            <div class="form-group">
                @Html.Label("Địa chỉ", new { @class = "col-md-5 control-label" })
                <div class="col-md-7">
                    @Html.TextBoxFor(m => m.Diachi, new { @class = "form-control" })
                    @Html.ValidationMessageFor(m => m.Diachi)
                </div>
            </div>
            <div class="form-group">
                @Html.Label("Số điện thoại", new { @class = "col-md-5 control-label" })
                <div class="col-md-7">
                    @Html.TextBoxFor(m => m.Sodienthoai, new { @class = "form-control" })
                    @Html.ValidationMessageFor(m => m.Sodienthoai)
                </div>
            </div>
           
            <div class="form-group container">
                @Html.Label("        ", new { @class = "col-md-5 control-label" })
                <div class="col-md-7">
                    <input type="submit" value="Cập nhật" onclick="form.action = '/Admin/Khachhang/Capnhat'" class="btn btn-default" />
                    <a href="/Admin/Khachhang/Xoa/@Model.Id" class="btn btn-default">Xóa</a>
                    <a href="/Admin/Khachhang/Index" class="btn btn-default">Hủy</a>

                </div>
            </div>


        }

    </div>

</div>
<hr />
<h2>Danh sách khách hàng hiện có</h2>
<table class="table table-bordered table-hover ">
    <tr>
        <th class="panel-heading">Id</th>
        <th class="panel-heading">Tên khách hàng</th>
        <th class="panel-heading">Tên đăng nhập</th>
        <th class="panel-heading">Mật khẩu</th>
        <th class="panel-heading">Email</th>
        <th class="panel-heading">Địa chỉ</th>
        <th class="panel-heading">Số điện thoại</th>
        
        <th></th>
    </tr>
    @foreach (Khachhang c in ViewBag.khachhang)
    {
        <tr>
            <td>@c.Id</td>
            <td>@c.Tenkhachhang</td>
            <td>@c.Tendangnhap</td>
            <td>@c.Matkhau</td>
            <td>@c.Email</td>
            <td>@c.Diachi</td>
            <td>@c.Sodienthoai</td>
            <td>
                <a href="/Admin/Khachhang/Sua/@c.Id" class="btn btn-default">Sửa</a>
                <a href="/Admin/Khachhang/Xoa/@c.Id" class="btn btn-default">Xóa</a>
            </td>
        </tr>
    }
</table>
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}